/*
 * Copyright (c) 2010 Curtis Boyden.  All rights reserved. 
 * This software was developed by Curtis Boyden and is provided under the terms 
 * of the GNU Lesser General Public License, Version 2.1. You may not use 
 * this file except in compliance with the license. If you need a copy of the license, 
 * please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is ejMud
 * (Ewerp Java MUD).  The Initial Developer is Curtis Boyden.
 *
 * Software distributed under the GNU Lesser Public License is distributed on an "AS IS" 
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
 * the license for the specific language governing your rights and limitations.
*/

package com.ewerp.mud.commands;

import com.ewerp.mud.core.session.parsers.TerminalLineParser.ITerminalLinePacketParser;
import com.ewerp.mud.entities.IEntity;


public class SayCommand extends BaseCommand {
    public static class SayCommandTerminalLinePacketParser implements ITerminalLinePacketParser  {
        @Override
        public ICommand parseTerminalLinePacket(IEntity source, String input) {
            SayCommand cmd = new SayCommand();
            
            cmd.setText(input);
            
            return cmd;
        }
    }
    
    protected IEntity source;
    protected String text;
    
    @Override
    public void execute() {
        System.out.println(text);
//        if(source instanceof ICharacter) {
//            ICharacter c = (ICharacter)getSource();
//            
//            SpeechMessage msg = new SpeechMessage();
//            
//            msg.setMeta(new AudibleMessage());
//            msg.setSource(getSource());
//            msg.setTarget(getTarget());
//            msg.setText(text);
//            
//            c.getRoom().dispatchMessage(msg); // audible(Speech), visible(Lips moving)
//        }
    }
    
    public void setSource(IEntity source) {
        this.source = source;
    }
    
    public void setText(String text) {
        this.text = text;
    }

}
